﻿@using GTAuto.DAL.DAL
@using GTAuto.DAL.Entities
@model GTAuto.DAL.Entities.GTFirm 
@{
    ViewBag.Title = "FirmView";
    Layout = "~/Views/Shared/_Layout.cshtml";


    List<GTFirmCategory> gtFirmCategories = DALFirms.Singleton.FirmsCategory(Model.Id);
    string catsString = "";
    if (gtFirmCategories.Count > 0)
    {
        catsString = gtFirmCategories.Aggregate(catsString, (current, gtFirmCategory) => current + "," + gtFirmCategory.Name);
    }
    catsString = catsString.Trim(',');

    int count;
    var adreses = DALFirmAdress.Singleton.GetPaged(Model.Id, 1, 100, out count);
}
<div id="list">
    @Html.Partial("Controls/BreadCrumbs")
    @Html.Partial("Controls/Favorites")
</div>
<div id="main_left">
    @Html.Partial("FirmsCategory")
</div>
<div id="main_center">
    <div class="shini_title">
        Автокиев</div>
    <div id="avtodileri_catalog">
        <ul>
            <li><span class="dileri_logo">
                <img src="@string.Format("{0}/{1}", DALSettngs.Singleton.Get("BrendLogosAdminView").Value, Model.Logo)" />
            </span><span class="dileri_text"><span class="stroka">Название компании: <span>@Model.Name</span>
            </span>
                @if (!string.IsNullOrEmpty(Model.SiteUrl))
                {
                    <span class="stroka">Сайт: <span><a href="#">www.reklama.ru</a></span> </span>
                }
                @if (!string.IsNullOrEmpty(catsString))
                {
                    <span class="stroka">Категории: <span>@catsString</span> </span>
                }
            </span><span class="clear"></span></li>
        </ul>
        <div class="content">
            <div class="title">
                Описание компании:</div>
            @Html.Raw(Model.Description)
            @if (adreses.Count > 0)
            {
                <div class="contact_info">
                    <div class="title">
                       Адреса компании:</div>
                </div>
            }
            @foreach (var ad in adreses)
            {

                <div class="contact_info">
                    <div class="title">
                        ---------------</div>
                    
                    @if(!string.IsNullOrEmpty(ad.Coment))
                    {
                       @Html.Raw(ad.Coment)<br />
                    }
                    @if(!string.IsNullOrEmpty(ad.Adress))
                    {
                       @Html.Raw(ad.Adress)<br />
                    }
                    @if(!string.IsNullOrEmpty(ad.Phone))
                    {
                      @Html.Raw("тел./факс - ") @Html.Raw(ad.Phone)<br />
                    }
                     @if(!string.IsNullOrEmpty(ad.Phone))
                    {
                      @Html.Raw("Режим работы: ") @Html.Raw(ad.WorkingTime)<br />
                    }
                </div>

                 if (!string.IsNullOrEmpty(ad.GoogleMap))
                  {
                      <div class="map">
                          <div class="title">
                              Схема проезда:</div>
                          @Html.Raw(ad.GoogleMap)
                      </div>
                  }
            }
        </div>
    </div>
</div>
<div id="main_right">
    @Html.Partial("Controls/Bunner")
    @Html.Partial("Controls/Reklama")
</div>
